﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ASPNETVN.PORTAL.Components.Share.Controls
{
    public partial class Download : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Attachment attachment = Attachment.Load(Convert.ToInt32(Request.QueryString["ItemId"]));
            Response.AppendHeader("content-disposition", "filename=" + attachment.FileName);
            Response.ContentType = "html/text";
            //Response.OutputStream.Write(attachment.Binary, 0, (int) attachment.FileSize);
            Response.BinaryWrite(attachment.BinaryContent);
        }
    }
}